<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="expires" content="0"><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>Welcome to Design Zone......</title>

<link rel="stylesheet" type="text/css"
	href="../../scripts/ext/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="../../styles/dzbase.css" />

<script type="text/javascript"
	src="../../scripts/ext/adapter/ext-base.js"></script>
<script type="text/javascript" src="../../scripts/ext/ext-all.js"></script>

<script type="text/javascript" src="../../scripts/i18nMessage.js"></script>
<script type="text/javascript" src="../../scripts/utils.js"></script>
<script type="text/javascript">
Ext.onReady(function(){
	
		Ext.QuickTips.init();

	    // turn on validation errors beside the field globally
	    Ext.form.Field.prototype.msgTarget = 'side';
		
		var idValue = getPrarmeterValue(window.location, 'id'); 
		var startPage = getPrarmeterValue(window.location, 'startPage');
	
		var messageForm = new Ext.FormPanel({
			labelAlign: 'top',
	        labelWidth: 75, // label settings here cascade unless overridden
	        url:'../../servlet/SysMenuServlet?action=1',
	        frame:true,
			reader : new Ext.data.XmlReader({
				record: 'item'
			},[
				{name: 'id', mapping: 'id'},
				{name: 'actionUrl', mapping: 'actionUrl'},
				{name: 'descriptionCn', mapping: 'descriptionCn'},
				{name: 'descriptionFr', mapping: 'descriptionFr'},
				{name: 'descriptionEn', mapping: 'descriptionEn'}
			]),
	        title: 'Menu Label Edit',
	        bodyStyle:'padding:5px 5px 5px 5px',
	        defaults: {width: '90%'},
	        defaultType: 'textfield',
	
	        items: [{
	                fieldLabel: 'ID',
					id: 'id',
	                name: 'id',
					xtype: 'hidden',
					value: idValue
	            },{
	                fieldLabel: 'Action Url',
	                name: 'actionUrl',
					maxLength: 128,
					maxLengthText: 'Key code is too long'
	            },{
	                fieldLabel: 'Description CN',
	                name: 'descriptionCn',
					allowBlank:false,
					xtype: 'textarea',
					blankText: 'Chinese message field must be filled out.',
					maxLength: 256,
					maxLengthText: 'Chinese message is too long'
	            },{
	                fieldLabel: 'Description FR',
	                name: 'descriptionFr',
					allowBlank:false,
					xtype: 'textarea',
					blankText: 'France message field must be filled out.',
					maxLength: 256,
					maxLengthText: 'France message is too long'
	            }, {
	                fieldLabel: 'Description EN',
	                name: 'descriptionEn',
					allowBlank:false,
					xtype: 'textarea',
					blankText: 'English message field must be filled out.',
					maxLength: 256,
					maxLengthText: 'English message is too long'
	            }
	        ],
	
	        buttons: [{
	            text: 'Save',
				handler: function(){
						if(messageForm.getForm().isValid()){
							//messageForm.hide();
							messageForm.getForm().submit({
								method: 'post',
								success: function(form, action){
									//alert(form);
									messageTip.msg('Tip', 'Save or update successfully.');
									//messageForm.show();
								},
								failure: function(form, action){
									//alert(form);
									messageTip.msg('Tip', 'Save or update unsuccessfully.');
									//messageForm.show();
								}
							});
						}
					}
	        },{
	            text: 'Cancel',
				handler: function(){
					if(startPage != null){
						window.location = 'menu_label_list.html?startPage=' + startPage;
					}else{
						window.location = 'menu_label_list.html';
					}
				}
	        }]
	    });
	
	    messageForm.render('SysMenu');
	
		
		if(idValue != null){
			messageForm.getForm().load({url:'../../servlet/SysMenuServlet?action=3&id=' + idValue, waitMsg:'Loading'});
		}
})

</script>
<title></title>
</head>
<body>
<div id="SysMenu"></div>
</body>
</html>